CentOS 7
Sponsored Link

OpenStack Queens : How to use Ceilometer(Nova Compute)
2018/03/11
 
This is how to use OpenStack Telemetry Service (Ceilometer) for Nova Compute service.
This example is based on the emvironment like follows.
     ------------+---------------------------+---------------------------+------------
                 |                           |                           |
             eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
     +-----------+-----------+   +-----------+-----------+   +-----------+-----------+
     |    [ Control Node ]   |   |    [ Storage Node ]   |   |    [ Compute Node ]   |
     |                       |   |                       |   |                       |
     |  MariaDB    RabbitMQ  |   |      Open_vSwitch     |   |        Libvirt        |
     |  Memcached  httpd     |   |        L2_Agent       |   |     Nova_Compute      |
     |  Keystone   Glance    |   |        L3_Agent       |   |      Open_vSwitch     |
     |  Nova_API  Cinder_API |   |     Metadata_Agent    |   |        L2_Agent       |
     |  Neutron_Server       |   |     Cinder_Volume     |   |  Ceilometer_Compute   |
     |  Metadata_Agent       |   |        Heat_API       |   |                       |
     |  Gnocchi              |   |      Heat Engine      |   |                       |
     |  Ceilometer_Central   |   |                       |   |                       |
     +-----------------------+   +-----------------------+   +-----------------------+

[1] Change settings for Nova Compute service to enable Telemetry data collention like follows.
[root@node01 ~]#
vi /etc/nova/nova.conf
# add follows into [DEFAULT] section

instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
# add to the end

[oslo_messaging_notifications]
driver = messagingv2
[root@node01 ~]#
systemctl restart openstack-nova-compute

[2] It's some example to display metrics and meters.
# create and start an instance

[cent@dlp ~(keystone)]$
Int_Net_ID=$(openstack network list | grep int_net | awk '{ print $2 }')

[cent@dlp ~(keystone)]$
openstack server create --flavor m1.small --image CentOS7 --security-group secgroup01 --nic net-id=$Int_Net_ID --key-name mykey CentOS_7

# list resources

[cent@dlp ~(keystone)]$
openstack metric resource list

+--------------------------------------+----------------------------+----------------------------------
| id                                   | type                       | project_id                       
+--------------------------------------+----------------------------+----------------------------------
| 70846728-419e-47bf-8b25-829d12edfca6 | instance                   | 52e02649325e4cf1b903d00cadb8fad2 
| 6edf4961-70e0-52f0-8723-6ed18d96776a | instance_disk              | 52e02649325e4cf1b903d00cadb8fad2 
| 6b2e6172-3c58-59d6-ac72-0c79ae0ce313 | instance_network_interface | 52e02649325e4cf1b903d00cadb8fad2 
+--------------------------------------+----------------------------+----------------------------------
+----------------------------------+-----------------------------------------------------------------------
| user_id                          | original_resource_id                                                  
+----------------------------------+-----------------------------------------------------------------------
| 3fc6c62eb5aa440aaa1eaf745faa35d6 | 70846728-419e-47bf-8b25-829d12edfca6                                  
| 3fc6c62eb5aa440aaa1eaf745faa35d6 | 70846728-419e-47bf-8b25-829d12edfca6-vda                              
| 3fc6c62eb5aa440aaa1eaf745faa35d6 | instance-00000008-70846728-419e-47bf-8b25-829d12edfca6-tap057170c7-2f 
+----------------------------------+-----------------------------------------------------------------------
+----------------------------------+----------+----------------------------------+--------------
| started_at                       | ended_at | revision_start                   | revision_end 
+----------------------------------+----------+----------------------------------+--------------
| 2018-03-12T06:57:09.393253+00:00 | None     | 2018-03-12T06:57:09.393289+00:00 | None         
| 2018-03-12T07:01:14.917494+00:00 | None     | 2018-03-12T07:01:14.917526+00:00 | None         
| 2018-03-12T07:01:15.017722+00:00 | None     | 2018-03-12T07:01:15.017769+00:00 | None         
+----------------------------------+----------+----------------------------------+--------------
+-------------------------------------------------------------------+
| creator                                                           |
+-------------------------------------------------------------------+
| 61d8449da0b345f2aecfaf0d13310bd7:b1da1070c8af427886d0202f8bbe414f |
| 61d8449da0b345f2aecfaf0d13310bd7:b1da1070c8af427886d0202f8bbe414f |
| 61d8449da0b345f2aecfaf0d13310bd7:b1da1070c8af427886d0202f8bbe414f |
+-------------------------------------------------------------------+

# details of the instance resource instance

[cent@dlp ~(keystone)]$
openstack metric resource show 70846728-419e-47bf-8b25-829d12edfca6

+-----------------------+---------------------------------------------------------------------+
| Field                 | Value                                                               |
+-----------------------+---------------------------------------------------------------------+
| created_by_project_id | b1da1070c8af427886d0202f8bbe414f                                    |
| created_by_user_id    | 61d8449da0b345f2aecfaf0d13310bd7                                    |
| creator               | 61d8449da0b345f2aecfaf0d13310bd7:b1da1070c8af427886d0202f8bbe414f   |
| ended_at              | None                                                                |
| id                    | 70846728-419e-47bf-8b25-829d12edfca6                                |
| metrics               | compute.instance.booting.time: b8cec50f-fd01-4e7e-930e-88e4060933d1 |
|                       | cpu.delta: 1cba0435-759b-4978-b7fe-6ade686ea341                     |
|                       | cpu: bf38d965-e078-4b74-b1d6-07c91fcf18d4                           |
|                       | cpu_l3_cache: a20519a8-6d6d-43f3-aa21-bef17ad65a92                  |
|                       | cpu_util: 4e21380b-3692-47ce-82aa-86feb9892ae4                      |
|                       | disk.allocation: 6482019c-470e-4a18-b6b7-6bb3a6982443               |
|                       | disk.capacity: c0d2a32d-f203-4939-baae-7ad80cee9155                 |
|                       | disk.ephemeral.size: e3177d45-c25c-4efb-9877-e73107547bc5           |
|                       | disk.iops: 1740b5d4-2b40-48c8-b5fd-1afbb58e6e09                     |
|                       | disk.latency: f1156a29-5b3f-469d-b786-b77701093364                  |
|                       | disk.read.bytes.rate: 4311f56f-75f2-4cb7-8090-c17cc3d38f3e          |
|                       | disk.read.bytes: ab4749c9-f665-4914-aae0-b5a9d700ce24               |
|                       | disk.read.requests.rate: 63e5afed-919e-4217-b5de-a538a8252349       |
|                       | disk.read.requests: 6c75cd41-f653-436e-943f-88c2cc1e9e80            |
|                       | disk.root.size: 9b80f579-43bc-4478-8e06-71956dfc787e                |
|                       | disk.usage: 9cf648f5-e7c6-4a6a-a5ca-715bb399200a                    |
|                       | disk.write.bytes.rate: 2b26ab8e-aab7-4c27-8f37-a52b02b4ceff         |
|                       | disk.write.bytes: 378f50de-f486-40af-a088-044f7a7117f2              |
|                       | disk.write.requests.rate: 91bedfe5-9614-491f-a7c1-93b0dfbf60e1      |
|                       | disk.write.requests: b79211de-0571-47ac-a164-b000ef9be219           |
|                       | memory.bandwidth.local: 8706d0b1-74d7-42a3-a2f0-10f5082c6587        |
|                       | memory.bandwidth.total: 4053aadd-95fd-4137-b191-53b52d9aa868        |
|                       | memory.resident: 096e8d2c-41b5-40c7-81e4-225488eb4196               |
|                       | memory.swap.in: 965cee35-6565-401d-8d03-fa61ab82ac5e                |
|                       | memory.swap.out: f9e66cba-c004-46c6-86bc-086662dbc150               |
|                       | memory.usage: 50189660-8ed1-42b6-8d43-a660bcec6aed                  |
|                       | memory: d64b3ef2-d565-40e7-88ca-02f8f1c232f7                        |
|                       | perf.cache.misses: 175a060b-c644-4c97-a31c-57a9a7316ab6             |
|                       | perf.cache.references: f6e32848-871d-4d17-84b4-06dc447aff4e         |
|                       | perf.cpu.cycles: bfb609e4-8019-4ef1-8a56-bdb39d0d9a3a               |
|                       | perf.instructions: a58867ae-a702-42f7-abf8-90a6888bfc60             |
|                       | vcpus: 1de20e23-32a7-405b-8df1-7f4a7d701571                         |
| original_resource_id  | 70846728-419e-47bf-8b25-829d12edfca6                                |
| project_id            | 52e02649325e4cf1b903d00cadb8fad2                                    |
| revision_end          | None                                                                |
| revision_start        | 2018-03-12T06:57:09.393289+00:00                                    |
| started_at            | 2018-03-12T06:57:09.393253+00:00                                    |
| type                  | instance                                                            |
| user_id               | 3fc6c62eb5aa440aaa1eaf745faa35d6                                    |
+-----------------------+---------------------------------------------------------------------+

# display instance boot time

[cent@dlp ~(keystone)]$
openstack metric measures show b8cec50f-fd01-4e7e-930e-88e4060933d1

+---------------------------+-------------+-----------+
| timestamp                 | granularity |     value |
+---------------------------+-------------+-----------+
| 2018-03-12T15:55:00+09:00 |       300.0 | 13.566016 |
+---------------------------+-------------+-----------+

# CPU

[cent@dlp ~(keystone)]$
openstack metric measures show bf38d965-e078-4b74-b1d6-07c91fcf18d4

+---------------------------+-------------+---------------+
| timestamp                 | granularity |         value |
+---------------------------+-------------+---------------+
| 2018-03-12T16:00:00+09:00 |       300.0 | 29760000000.0 |
| 2018-03-12T16:05:00+09:00 |       300.0 |    3.2259e+11 |
+---------------------------+-------------+---------------+

# memory usage

[cent@dlp ~(keystone)]$
openstack metric measures show 50189660-8ed1-42b6-8d43-a660bcec6aed

+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2018-03-12T16:00:00+09:00 |       300.0 | 240.0 |
| 2018-03-12T16:05:00+09:00 |       300.0 | 240.0 |
| 2018-03-12T16:10:00+09:00 |       300.0 | 240.0 |
+---------------------------+-------------+-------+

# details of instance_network_interface

[cent@dlp ~(keystone)]$
openstack metric resource show 6b2e6172-3c58-59d6-ac72-0c79ae0ce313

+-----------------------+-----------------------------------------------------------------------+
| Field                 | Value                                                                 |
+-----------------------+-----------------------------------------------------------------------+
| created_by_project_id | b1da1070c8af427886d0202f8bbe414f                                      |
| created_by_user_id    | 61d8449da0b345f2aecfaf0d13310bd7                                      |
| creator               | 61d8449da0b345f2aecfaf0d13310bd7:b1da1070c8af427886d0202f8bbe414f     |
| ended_at              | None                                                                  |
| id                    | 6b2e6172-3c58-59d6-ac72-0c79ae0ce313                                  |
| metrics               | network.incoming.bytes.rate: 3ad64b75-f14e-48ed-8459-9a45597905d8     |
|                       | network.incoming.bytes: c2491d44-0243-4852-a057-e0c895cfdc3b          |
|                       | network.incoming.packets.drop: 54401f68-3e43-49ce-a7b8-bda1500341a6   |
|                       | network.incoming.packets.error: 84679442-3d22-48c3-a706-6876d5355b0c  |
|                       | network.incoming.packets.rate: 93c97129-a734-443c-ab23-0f20e0c12a71   |
|                       | network.incoming.packets: 475e212c-1a6d-46a0-9e45-f60ad974db8d        |
|                       | network.outgoing.bytes.rate: 01c89483-d22f-47e1-9599-941003df6d44     |
|                       | network.outgoing.bytes: 16ac9c37-8b38-4332-a7c4-df493fabbdd6          |
|                       | network.outgoing.packets.drop: 211daadc-8e00-4c5d-8a21-044220a03ee9   |
|                       | network.outgoing.packets.error: 2c2286bd-5e45-42f3-87c9-4cbbe2932b92  |
|                       | network.outgoing.packets.rate: fda6c2f2-33fb-470b-be17-f0a79cc6e308   |
|                       | network.outgoing.packets: 7664d490-58e8-4448-aa47-05c9a5c51232        |
| original_resource_id  | instance-00000008-70846728-419e-47bf-8b25-829d12edfca6-tap057170c7-2f |
| project_id            | 52e02649325e4cf1b903d00cadb8fad2                                      |
| revision_end          | None                                                                  |
| revision_start        | 2018-03-12T07:01:15.017769+00:00                                      |
| started_at            | 2018-03-12T07:01:15.017722+00:00                                      |
| type                  | instance_network_interface                                            |
| user_id               | 3fc6c62eb5aa440aaa1eaf745faa35d6                                      |
+-----------------------+-----------------------------------------------------------------------+

# display network incoming bytes

[cent@dlp ~(keystone)]$
openstack metric measures show c2491d44-0243-4852-a057-e0c895cfdc3b

+---------------------------+-------------+---------+
| timestamp                 | granularity |   value |
+---------------------------+-------------+---------+
| 2018-03-12T16:00:00+09:00 |       300.0 | 34331.0 |
| 2018-03-12T16:05:00+09:00 |       300.0 | 39849.0 |
| 2018-03-12T16:10:00+09:00 |       300.0 | 41823.0 |
+---------------------------+-------------+---------+

# display network outgoing bytes

[cent@dlp ~(keystone)]$
openstack metric measures show 16ac9c37-8b38-4332-a7c4-df493fabbdd6

+---------------------------+-------------+---------+
| timestamp                 | granularity |   value |
+---------------------------+-------------+---------+
| 2018-03-12T16:00:00+09:00 |       300.0 | 30733.0 |
| 2018-03-12T16:05:00+09:00 |       300.0 | 34841.0 |
| 2018-03-12T16:10:00+09:00 |       300.0 | 36809.0 |
+---------------------------+-------------+---------+
 
Tweet